<template>
  <el-form ref="formRef" :model="form" label-position="top" :label-width="140">
    <el-form-item label="需求验货数量" prop="process_num" :rules="[{ required: true, message: '不能为空', trigger: 'change' }]">
     <el-input-number v-model="form.process_num" controls-position="right" :min="0" :step="1" :precision="0" class="w-full" />
    </el-form-item>
    <el-form-item label="需求验货时间" prop="inspection_time" :rules="[{ required: true, message: '不能为空', trigger: 'change' }]">
     <el-date-picker v-model="form.inspection_time" placeholder="日期选择" type="date" value-format="YYYY-MM-DD" class="w-full" />
    </el-form-item>
    <el-form-item label="截止验货时间" prop="end_inspection_time" :rules="[{ required: true, message: '不能为空', trigger: 'change' }]">
     <el-date-picker v-model="form.end_inspection_time" placeholder="日期选择" type="datetime" value-format="YYYY-MM-DD HH:00:00" class="w-full" />
    </el-form-item>
  </el-form>
</template>

<script setup>
const props = defineProps({
  modelValue: { type: Object, default: () => ({}) },
  options: { type: Object, default: () => ({}) },
})
const emit = defineEmits(['update:modelValue'])
const form = computed({
  get() {
    return props.modelValue
  },
  set(val) {
    emit('update:modelValue', val)
  }
})
const formRef = ref()
const validate = async() => await formRef?.value.validate(res => res)
defineExpose({validate})
</script>